<template>
    <div
        class="cash-contnair"
        v-loading="isLoading"
        element-loading-background="rgba(250, 250, 250, 0.7)"
    >
        <!-- 现金分期 -->
        <!-- <el-card
      shadow="never"
      v-loading="isLoading"
      element-loading-background="rgba(250, 250, 250, 0.7)"
    >
      <div slot="headerss" class="clearfix">
        <span>现金分期</span>
        <el-button style="float: right; padding: 3px 20px;" type="text">关 闭</el-button>
        </div>-->
        <cardComponent pageTitle="现金分期">
            <template slot="cardBody">
                <el-form
                    ref="cashFormRef"
                    :rules="cashFormRules"
                    :model="cashForm"
                    label-width="220px"
                    size="small"
                >
                    <el-row>
                        <el-col :span="7">
                            <el-form-item label="账户类别 : " label-width="135px">
                                <el-input disabled v-model="cashForm.CATEGORY" style="width: 100%;"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="主卡卡号 : " label-width="150px">
                                <el-input disabled v-model="cashForm.CARDNBR" style="width: 100%;"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="9">
                            <el-form-item label="签约借记卡卡号 : " label-width="150px">
                                <el-input disabled v-model="cashForm.CARDNAME" style="width: 100%;"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="7">
                            <el-form-item label="现金分期固定额度 : " label-width="135px">
                                <el-input disabled v-model="cashForm.CALIMIT" style="width: 100%;"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item label="现金分期可用额度 : " label-width="150px">
                                <el-input
                                    class="t-red"
                                    disabled
                                    v-model="cashForm.CALAVAL"
                                    style="width: 100%;"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="9">
                            <el-form-item label="分期金额 : " label-width="150px" prop="AMT">
                                <el-input
                                    @blur="onChanger('cashFormRef')"
                                    maxlength="7"
                                    v-model="cashForm.AMT"
                                    style="width: 100%;"
                                    placeholder="请输入分期金额"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- 试算列表 -->
                    <el-table
                        :data="tableData"
                        style="width: 100%;"
                        class="heard-bg business_table"
                        size="small"
                        border
                        stripe
                    >
                        <el-table-column label="费用试算表">
                            <el-table-column prop="NBRMTHS1" label="分期期数" min-width="160">
                                <template slot-scope="scope">
                                    <el-select
                                        v-model="scope.row.NBRMTHS1"
                                        size="small"
                                        placeholder="选择分期数"
                                        @change="onChanger('cashFormRef')"
                                    >
                                        <el-option
                                            v-for="(item, index) in instalmentNoList"
                                            :key="index"
                                            :label="item.label"
                                            :value="item.nbrMths"
                                        ></el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column prop="CHARGETYPE" label="手续费收取方式" min-width="160">
                                <template slot-scope="scope">
                                    <el-select
                                        v-model="scope.row.CHARGETYPE"
                                        :disabled="isThree"
                                        style="width: 100%;"
                                        placeholder="手续费收取方式"
                                        @change="onChanger('cashFormRef')"
                                    >
                                        <el-option label="一次性收取" value="0"></el-option>
                                        <el-option label="分期收取" value="1"></el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column prop="CLPPS" label="资金用途" min-width="160">
                                <template slot-scope="scope">
                                    <el-select
                                        v-model="scope.row.CLPPS"
                                        clearable
                                        style="width: 100%;"
                                        placeholder="请选择资金用途"
                                    >
                                        <el-option
                                            v-for="(item, index) in cashpurposeList"
                                            :key="index"
                                            :label="item.label"
                                            :value="item.code"
                                        ></el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column prop="OUTFLAG" label="转入银行卡类型" min-width="160">
                                <template slot-scope="scope">
                                    <el-select
                                        :class="iserr ? 'iserr' : ''"
                                        v-model="scope.row.OUTFLAG"
                                        style="width: 100%;"
                                        placeholder="选择银行卡类型"
                                    >
                                        <el-option label="无" value></el-option>
                                        <el-option label="本行" value="C"></el-option>
                                        <el-option label="他行" value="X"></el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column prop="CORPUS" label="首期还款额" min-width="100"></el-table-column>
                            <el-table-column prop="REMONTHFEE" label="月还款额" min-width="100"></el-table-column>
                            <el-table-column prop="ALLMONTHSFEE" label="分期手续费" min-width="100"></el-table-column>
                            <el-table-column prop="ALLCOUNTFEE" label="本金+手续费总额" min-width="140"></el-table-column>
                        </el-table-column>
                    </el-table>
                </el-form>
                <div class="footer">
                    <el-button type="primary" size="small" @click="onEditInfor">修改信息</el-button>
                    <el-button type="primary" size="small" @click="onSubmit('cashFormRef')">申 请</el-button>
                    <!-- <el-button>关 闭</el-button> -->
                </div>
                <!-- </el-card> -->

                <!-- 申请成功窗口 -->
                <ConfirmWindow
                    v-if="showsuccess"
                    @isShow="close"
                    :dataList="cashsuccess"
                    :title="'现金分期申请成功!'"
                />
            </template>
        </cardComponent>
    </div>
</template>

<script>
import { mapState } from 'vuex';
import cardComponent from '@/components/cardComponent/cardComponent.vue';
import ConfirmWindow from '@/components/ConfirmWindow/ConfirmWindow.vue';
import {
    getInstalmentList,
    getDictSelectList,
    closePage,
    itoStr,
    getDictMappingValue,
} from '@/utils/Common';
import { get_3xxx, get_4xxx, get_FQxx } from '@/apis/getAPIClass';
import { RegConfig } from '@/utils/RegConfig';
import { setNumber, tbBudgetRequisi } from '@/utils/Object';

export default {
    data() {
        return {
            cashForm: {
                CATEGORY: '', // 3001
                CARDNBR: '', // 3001
                CALIMIT: '', // 3001
                CALAVAL: '', // 3001
                MPAMT: '',
                NBRMTHS1: undefined,
                CHARGETYPE: undefined,
                CLPPS: undefined,
                CORPUS: '',
                REMONTHFEE: '',
                ALLMONTHSFEE: '',
                ALLCOUNTFEE: '',
                OUTFLAG: undefined,
                CUSTRNAME: '', // 3052 申请转入的银行卡持卡人姓名
                CARDNAME: '', // 3052 申请转入的银行卡号
                BANKNO: '', // 3052 申请转入的银行行号
                OUTEXP: '', // 3052 申请转入的银行卡卡片有效期
                AMT: '',
            },
            iserr: true,
            cashEditForm: {},
            cashFormRules: {
                AMT: [
                    {
                        required: true,
                        message: '请输入分期金额',
                        trigger: 'blur',
                    },
                    {
                        validator: (rule, value, callback) => {
                            if (value < 200) {
                                callback(new Error('请输入大于等于200的分期金额'));
                            } else {
                                callback();
                            }
                        },
                        trigger: 'blur',
                    },
                    {
                        validator: (rule, value, callback) => {
                            if (parseInt(value, 10) % 100 != 0) {
                                callback(new Error('输入金额只能是整百的！'));
                            } else {
                                callback();
                            }
                        },
                        trigger: 'blur',
                    },
                ],
            },
            tableData: [
                {
                    AMT: '',
                    NBRMTHS1: undefined,
                    CHARGETYPE: undefined,
                    OUTFLAG: undefined,
                    CLPPS: undefined,
                    OUTFLAG: undefined,
                    CORPUS: '' || 0,
                    REMONTHFEE: '' || 0,
                    ALLMONTHSFEE: '' || 0,
                    ALLCOUNTFEE: '' || 0,
                },
            ],
            instalmentNoList: [],
            cashpurposeList: [],
            AMT: '',
            showTrial: false,
            showEdit: false,
            isLoading: false,
            timeID: '',
            CREDNO: '',
            showsuccess: false,
            cashsuccess: [],
            isThree: true,
            productId: '',
        };
    },
    name: 'cash',
    components: {
        cardComponent,
        ConfirmWindow,
    },
    async mounted() {
        // 判断是否有当前权限
        await this.getExecuteFun();
        if (this.isLoading) return false;
        // 获取信用计划编号 下拉选择列表
        this.getBaseData();
        const resss = await getDictMappingValue('CATE', this.cardInfo_3004.CATEGORY, this);
        this.cashForm.CATEGORY = resss || this.cardInfo_3004.CATEGORY;
        this.onLoadOBJ();
    },
    computed: mapState({
        defaultParams: state => state.common.defaultParams, // 接口默认参数
        cardInfo_3004: state => state.common.cardInfo_3004,
        cardList_3601: state => state.common.cardList_3601,
        inlineParams: state => state.common.inlineParams, // 卡系统交易请求报文,
        pinFlag: state => state.common.pinFlag, // 是否密码检查标志
    }),
    methods: {
        // 判断是否有当前权限
        async getExecuteFun() {
            this.isLoading = true;
            this.productId = itoStr(this.cardInfo_3004.PRODUCT, 4) || this.cardInfo_3004.PRODUCT;
            console.log(this.productId);
            if (this.productId === '0055' || this.productId === '0056') {
                return this.$alert('该卡种不支持现金分期！', '接口提示', {
                    customClass: 'warning', type: 'warning',
                    showClose: false,
                }).then(() => {
                    closePage(this.$route, this, 1);
                });
            }
            this.isLoading = false;
        },
        // 获取分期期数 资金用途 下拉选择数据
        async getBaseData() {
            console.log(1);
            try {
                // 分期期数
                this.instalmentNoList = await getInstalmentList('2002', this);
                console.log(this.instalmentNoList, 'instalmentNoList');
            } catch (error) {
                console.warn(error, '获取分期期数失败');
            }

            try {
                // 资金用途
                this.cashpurposeList = await getDictSelectList('7100', this);
                console.log(this.cashpurposeList, 'cashpurposeList');
            } catch (error) {
                console.warn(error, '获取资金用途失败');
            }
        },
        // 页面加载获取页面数据请求_3052_3001请求
        async onLoadOBJ() {
            this.cashForm.CARDNBR = this.cardInfo_3004.CARDNO;
            this.isLoading = true;
            // 3052 配置请求头
            const appBody_3052 = {
                CARDNBR: this.cashForm.CARDNBR || '', // 卡号,
                PINFLAG: this.pinFlag,
                INQOPT: 1,
            };
            // 3001 配置请求头
            const appBody_3001 = {
                CARDNO: this.cashForm.CARDNBR || '',
                PINFLAG: this.pinFlag,
                FINAVAIYN: 0,
            };

            const result_3052 = await get_3xxx(
                '3052',
                '现金分期',
                appBody_3052,
                this,
                false,
            );
            const result_3001 = await get_3xxx(
                '3001',
                '现金分期',
                appBody_3001,
                this,
            );
            // console.log(result_3052, result_3001);
            if ((!result_3052, !result_3001)) return false;

            if (result_3052.sysHead.rspCd === '000000') {
                this.cashForm.CARDNAME = result_3052.body.appBody.CARDNAME;
                this.cashForm.CUSTRNAME = result_3052.body.appBody.CUSTRNAME;
                this.cashForm.BANKNO = result_3052.body.appBody.BANKNO;
            }
            if (result_3001.sysHead.rspCd === '000000') {
                this.cashForm.CALIMIT = result_3001.body.appBody.CALLIMIT;
                this.cashForm.CALAVAL = result_3001.body.appBody.CALAVAL;
                this.tableData[0].NBRMTHS1 = '3';
                this.tableData[0].CHARGETYPE = '0';
            }
            this.isLoading = false;
        },
        onEditInfor() {
            this.$router.push('/cashInstalment/cashInstUpdate');
            // this.showEdit = true;
            // this.cashEditForm.CATEGORY = this.cashForm.CATEGORY;
            // this.cashEditForm.CARDNBR = this.cashForm.CARDNBR;
            // this.cashEditForm.CARDNAME = this.cashForm.CARDNAME;
            // this.cashEditForm.CUSTRNAME = this.cashForm.CUSTRNAME;
            // this.cashEditForm.BANKNO = this.cashForm.BANKNO;
        },
        // 4075 試算請求
        async onChanger(ref) {
            console.log(
                this.tableData[0].NBRMTHS1,
                this.tableData[0].CHARGETYPE,
                '1',
            );
            if (this.tableData[0].NBRMTHS1 == '3') {
                this.tableData[0].CHARGETYPE = '0';
                this.isThree = true;
                console.log(
                    this.tableData[0].NBRMTHS1,
                    this.tableData[0].CHARGETYPE,
                    '2',
                );
            } else {
                this.isThree = false;
            }

            this.$refs[ref].validate(async (valid) => {
                if (!valid) return false;
                // if (
                //   !this.cashForm.AMT ||
                //   !this.tableData[0].NBRMTHS1 ||
                //   !this.tableData[0].CHARGETYPE
                // )
                //   return false;
                // 判断是他行还是本行
                // if (this.tableData[0].OUTFLAG === "C") {
                //   // 请求行内接口
                //   //本行根据分期期数和手续费支付方式确定信用计划编号

                //   if (this.tableData[0].CHARGETYPE == "0") {
                //     //一次性收取
                //     if (this.tableData[0].NBRMTHS1 == "3") {
                //       this.CREDNO = "2002";
                //     } else {
                //       this.CREDNO = "2012";
                //     }
                //   } else {
                //     //分期收取
                //     if (this.tableData[0].NBRMTHS1 == "3") {
                //       this.CREDNO = "2012";
                //     } else {
                //       this.CREDNO = "2002";
                //     }
                //   }
                //   this.isLoading = false;
                //   return this.$alert("需要连接到行内接口 FQ01 申请", "接口提示", {
                //     confirmButtonText: "确定"
                //   });
                // }
                // 他行根据分期期数和手续费支付方式确定信用计划编号
                if (this.tableData[0].CHARGETYPE == '0') {
                    // 一次性收取
                    if (this.tableData[0].NBRMTHS1 == '3') {
                        this.CREDNO = '2001';
                    } else {
                        this.CREDNO = '2011';
                    }
                } else {
                    // 分期收取
                    if (this.tableData[0].NBRMTHS1 == '3') {
                        this.CREDNO = '2011';
                    } else {
                        this.CREDNO = '2001';
                    }
                }
                // this.tableData[0].NBRMTHS1
                const res = await this.get_4075(
                    '现金分期试算',
                    3,
                    '',
                    '',
                    '',
                    '',
                    this.CREDNO,
                    this.cashForm.AMT,
                    this.tableData[0].NBRMTHS1,
                    '',
                    '',
                );

                console.log(res);
                if (!res) return false;
                const feeInstl = res.body.appBody.FEEINSTL; // 月手续费
                const instalAmt = res.body.appBody.INSTALAMT; // 月还款额
                const feeAmt = res.body.appBody.FEEAMT; // 手续费
                const feePcnt = res.body.appBody.FEEPCNT; // 利率
                const feeFlag = res.body.appBody.FEEFLAG; // 0：一次性收取 1：分期收取
                const mp_irr = res.body.appBody.MPIRR; // 年化利率

                const amount = this.cashForm.AMT;
                const mon = parseInt(this.tableData[0].NBRMTHS1);
                // 首期还款额 = 本金 / 期数 + 总手续费
                const firstAmts = amount / mon + feeAmt;

                // 总还款额 = 总手续费 + 本金
                const allcountfee = feeAmt * 1 + amount * 1;
                // 本金 = 本金 / 期数
                let corpus = 0;
                corpus = amount / mon;
                // if (feeFlag == 0) {
                //   feeAmt = feeAmt * 0.75;
                //   firstAmts = (firstAmts - corpus) * 0.75 + corpus;
                //   allcountfee = allcountfee - feeAmt / 3;
                // }
                this.tableData[0].REMONTHFEE = instalAmt.toFixed(2);
                this.tableData[0].CORPUS = firstAmts.toFixed(2);
                this.tableData[0].ALLMONTHSFEE = feeAmt.toFixed(2);
                this.tableData[0].ALLCOUNTFEE = allcountfee.toFixed(2);
            });
        },
        // 修改现金贷资料 4075 请求
        async setEditCash() {
            this.isLoading = true;
            // 4075 配置请求头
            const appBody_4075 = {
                CARDNBR: this.cashEditForm.CARDNBR || '', // 卡号,
                PINFLAG: this.pinFlag,
                OPERTP: 0,
                OUTCARDNBR: this.cashEditForm.CARDNAME, // 申请转入的银行卡卡号
                OUTBANKNAME: this.cashEditForm.CARDBANK, // 申请转入的银行卡银行名称
                OUTEXP: this.cashEditForm.CARDNAME, // 申请转入的银行卡卡片有效期
                OUTFLAG: this.tableData[0].OUTFLAG, // 申请转移的银行卡类型
                OUTBANK: this.cashEditForm.BANKNO, // 申请转入的银行卡银行行号
                CALNAME: this.cashEditForm.CUSTRNAME, // 申请转入的银行卡持卡人姓名 选填
                MPDRTYN: 1,
                BTYPE: 0,
            };
            const defaultParams_4075 = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams_4075.body.appHead.tranCode = '4075';
            defaultParams_4075.body.appBody = appBody_4075;
            // 发送_4075请求
            try {
                const _4075 = await this.$post.common.transPort(
                    defaultParams_4075,
                );
                console.log(_4075);
                if (_4075.status === 200) {
                    const result_4075 = JSON.parse(_4075.data.jsonRes);
                    console.log(result_4075);
                    if (result_4075.sysHead.rspCd === '000000') {
                        this.$message.success('现金贷数据修改成功');
                    } else {
                        this.isLoading = false;
                        return this.$alert(
                            `错误代码：${result_4075.sysHead.rspCd}，错误信息：${result_4075.sysHead.rspMsg}`,
                            '现金贷数据修改失败！',
                            { center: true, customClass: 'warning ' },
                        );
                    }
                }
                this.isLoading = false;
            } catch (error) {
                this.$message.error('获取数据失败');
                this.isLoading = false;
            }
        },
        // 申请按钮
        async onSubmit(ref) {
            this.$refs[ref].validate(async (valid) => {
                if (!valid) return false;
                let res = {};
                if (
                    // !this.cashForm.AMT ||
                    // !this.tableData[0].CLPPS ||
                    !this.tableData[0].NBRMTHS1
                    || !this.tableData[0].CHARGETYPE
                    || !this.tableData[0].OUTFLAG
                ) return this.$alert('请选择转入银行卡类型', '输入提示');
                const confirmResult = await this.$confirm(
                    '此操作将申请现金分期, 是否继续?',
                    '现金分期提示',
                    {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        customClass: 'warning', type: 'warning',
                    },
                ).catch(err => err);
                if (confirmResult !== 'confirm') return this.$message.info('已取消申请现金分期');
                // 判断是他行还是本行
                if (this.tableData[0].OUTFLAG === 'C') {
                    // 请求行内接口
                    // 本行根据分期期数和手续费支付方式确定信用计划编号

                    if (this.tableData[0].CHARGETYPE == '0') {
                        // 一次性收取
                        if (this.tableData[0].NBRMTHS1 == '3') {
                            this.CREDNO = '2002';
                        } else {
                            this.CREDNO = '2012';
                        }
                    } else {
                        // 分期收取
                        if (this.tableData[0].NBRMTHS1 == '3') {
                            this.CREDNO = '2012';
                        } else {
                            this.CREDNO = '2002';
                        }
                    }

                    // 请求行内接口
                    const appBody_FQ01 = {
                        SOURCE: 'AG', // 交易来源
                        CARDNBR: this.cashForm.CARDNBR,
                        PINFLAG: this.pinFlag,
                        OPERTP: 1,
                        CREDNO: this.CREDNO, // //信用计划编号 操作类型为1时填写填写9999，则申请余额转移，其他为现金贷款。
                        MPAMT: setNumber(this.cashForm.AMT, 12), // 分期金额
                        NBRMTHS: setNumber(this.tableData[0].NBRMTHS1, 3, false), // 分期期数
                        LOADFLAG: '2',
                        MPDRTYN: 0,
                        BTYPE: 0,
                    };
                    // 发送_FQ02请求 //   数据存在 resultData.body.appBody
                    const result_FQ01 = await get_FQxx(
                        'FQ01',
                        '按日贷申请',
                        appBody_FQ01,
                        this,
                    );
                    console.log(result_FQ01);
                    if (!result_FQ01) return false;
                    res = result_FQ01.body.appBody;
                } else {
                    // 他行根据分期期数和手续费支付方式确定信用计划编号
                    if (this.tableData[0].CHARGETYPE == '0') {
                        // 一次性收取
                        if (this.tableData[0].NBRMTHS1 == '3') {
                            this.CREDNO = '2001';
                        } else {
                            this.CREDNO = '2011';
                        }
                    } else {
                        // 分期收取
                        if (this.tableData[0].NBRMTHS1 == '3') {
                            this.CREDNO = '2011';
                        } else {
                            this.CREDNO = '2001';
                        }
                    }

                    const res_4075 = await this.get_4075(
                        '现金分期申请',
                        1,
                        '',
                        '',
                        '',
                        this.tableData[0].OUTFLAG,
                        this.CREDNO,
                        this.cashForm.AMT,
                        this.tableData[0].NBRMTHS1,
                        '1',
                        '',
                    );

                    if (!res_4075) return false;
                    res = res_4075.body.appBody;
                }
                console.log(res);
                res.CALLIMIT = res.CALLIMIT.toFixed(2);
                res.CALAVAL = res.CALAVAL.toFixed(2);
                res.MPAMT = res.MPAMT.toFixed(2);
                res.INSTALAMT = res.INSTALAMT.toFixed(2);
                res.FEEAMT = res.FEEAMT.toFixed(2);
                res.LOADFLAG = res.LOADFLAG == '1' ? '是' : '否';

                // 配置成功之后展示的数据
                this.cashsuccess = [
                    { keys: '主卡卡号 : ', values: res.CARDNBR },
                    { keys: '现金贷款额度 : ', values: res.CALLIMIT },
                    { keys: '现金贷款可用额度 : ', values: res.CALAVAL },
                    { keys: '分期金额 : ', values: res.MPAMT },
                    { keys: '分期期数 : ', values: res.NBRMTHS },
                    { keys: '每月还款额 : ', values: res.INSTALAMT },
                    { keys: '手续费 : ', values: res.FEEAMT },
                    { keys: '出小额汇出文件 : ', values: res.LOADFLAG },
                ];
                console.log(this.cashsuccess);
                this.showsuccess = true;

                // 发送新增分期申请记录 tbBudgetRequisi
                const tbBudgetRequisiData = JSON.parse(JSON.stringify(tbBudgetRequisi));
                tbBudgetRequisiData.agentid = this.defaultParams.body.appHead.opeNo;
                tbBudgetRequisiData.allcountfee = res.FEEAMT;
                tbBudgetRequisiData.banknum = this.defaultParams.body.appHead.bnknbr;
                tbBudgetRequisiData.budgettype = res.OPERTP;
                tbBudgetRequisiData.custid = this.cardInfo_3004.CUSTID || '无';
                tbBudgetRequisiData.custname = this.cardInfo_3004.NAME;
                tbBudgetRequisiData.custno = res.CARDNBR;
                tbBudgetRequisiData.instalamt = res.MPAMT;
                // tbBudgetRequisiData.jzrate = res.FEERATE
                tbBudgetRequisiData.planno = res.CREDNO;
                tbBudgetRequisiData.retcode = '000000';
                tbBudgetRequisiData.monthnbr = res.NBRMTHS;

                console.log(tbBudgetRequisiData);
                try {
                    const resss = await this.$post.businessStatistics.addTbBudgetRe(
                        tbBudgetRequisiData,
                    );
                    console.log(resss);
                } catch (error) {
                    console.warn(error);
                }

                this.$refs.cashFormRef.resetFields();
                this.cashForm.AMT = '';
                this.tableData[0].CLPPS = '';
                this.tableData[0].OUTFLAG = '';
                this.tableData[0].CORPUS = '0';
                this.tableData[0].REMONTHFEE = '0';
                this.tableData[0].ALLMONTHSFEE = '0';
                this.tableData[0].ALLCOUNTFEE = '0';
                this.isLoading = false;
            });
        },
        // 请求4075数据(操作类型, 申请转入的银行卡卡号,申请转入的银行卡银行名称,有效期)
        async get_4075(
            masg,
            OPERTP,
            OUTCARDNBR,
            OUTBANKNAME,
            OUTEXP,
            OUTFLAG,
            CREDNO,
            MPAMT,
            NBRMTHS,
            LOADFLAG,
            OUTBANK,
        ) {
            // 4075 配置请求头
            const appBody_4075 = {
                CARDNBR: this.cashForm.CARDNBR, // 卡号,
                PINFLAG: this.pinFlag, // 是否检查密码标志
                OPERTP, // 操作类型 0－现金贷款/余额转移申请资料修改 1－现金贷款/余额转移申请 2－现金贷款/余额转移当日撤销 3—现金贷款/余额转移试算
                OUTCARDNBR, // 申请转入的银行卡卡号  操作类型为0时必填 操作类型为1时选填
                OUTBANKNAME, // 申请转入的银行卡银行名称 操作类型为0时必填 操作类型为1时选填
                OUTEXP, // 申请转入的银行卡卡片有效期 操作类型为0时必填 操作类型为1时选填
                OUTFLAG, // 申请转移的银行卡类型  操作类型为0时必填  操作类型为1时选填  空格：无  C：本行  X：他行
                CREDNO, // 信用计划编号 操作类型为1时填写填写9999，则申请余额转移，其他为现金贷款。
                MPAMT: setNumber(MPAMT, 12), // 分期金额
                NBRMTHS: setNumber(NBRMTHS, 3, false), // 分期期数
                LOADFLAG, // 放款方式 操作类型为1时，申请现金贷款时必填：0：大额现金贷款 1：小额现金贷款，余额转移 2：系统外实时放款 4:系统内实时放款
                OUTBANK, // 申请转入的银行卡银行行号 操作类型为0时必填  操作类型为1时选填
                CALNAME: '', // 申请转入的银行卡持卡人姓名 选填
                MPDRTYN: 0,
                BTYPE: 0,
            };
            console.log(appBody_4075);

            const result_4075 = await get_3xxx('4075', masg, appBody_4075, this);
            console.log(result_4075);
            if (!result_4075) return false;
            return result_4075;
        },
        closeEdit() {
            this.showEdit = false;
            this.$refs.cashEditFormRef.resetFields();
        },
        // 将组件返回的false赋值给当前
        close(data) {
            this.showsuccess = data;
        },
    },
};
</script>

<style  scoped lang="scss">
.cash-contnair {
    /deep/.el-card__header {
        padding: 8px !important;
    }
    .form-row {
        width: 100%;
        margin: 0 auto;
        .el-form {
            margin: 0 auto;
            width: 1000px;
            .el-form-item__content {
                text-align: left;
            }
        }
        .el-select {
            width: 100%;
        }
        .sub-title {
            color: #909399;
        }
    }
    .el-col {
        text-align: center;
    }
    .el-form-item {
        text-align: left;
    }
    .footer {
        text-align: center;
        margin-top: 10px;
    }
}
</style>
